﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AddressBook.Master" AutoEventWireup="true" CodeBehind="ManageEvents.aspx.cs" Inherits="AddressBook.Web.ManageEvents" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContentPlaceHolder" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainPaneContentPlaceHolder" runat="server">
<table border="0" cellpadding="0" cellspacing="0" style="width: 674px; margin: 0px auto;">
		<tr>
			<td valign="top">
				<div class="EventList">
					<div class="ListHeader">
						Events
						<div style="float: right;">
							<asp:ImageButton ID="EventListAddEventButton" runat="server" ImageUrl="~/Images/add_16.png" AlternateText="Add Event" ToolTip="Add Event" />
						</div>
					</div>
					<asp:ListView ID="ManageEventsEventList" runat="server" 
												OnItemCommand="ManageEventsEventList_ItemCommand" 
												OnItemEditing="ManageEventsEventList_ItemEditing" 
												OnItemDeleting="ManageEventsEventList_ItemDeleting" >
						<LayoutTemplate>
							<ul style="list-style-image: none; list-style-type: none; width: 300px; padding-left: 0px; margin: 0px;">
								<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
							</ul>
						</LayoutTemplate>
						<ItemTemplate>
							<li style="padding: 4px 4px; line-height: 16px;">
								<asp:ImageButton ID="EditButton" runat="server" CommandName="Edit" CommandArgument='<%# Eval("Id") %>' ImageUrl="~/Images/edit_Event_16.png" AlternateText="Open Event" ToolTip="Open Event" ImageAlign="Bottom" />
								<asp:ImageButton ID="DeleteButton" runat="server" CommandName="Delete" CommandArgument='<%# Eval("Id") %>' ImageUrl="~/Images/delete_16.png" AlternateText="Delete Event" ToolTip="Delete Event" ImageAlign="Bottom" />
								<asp:Literal ID="EventName" runat="server" Text='<%# Eval("Name") %>' />
								<cc1:ConfirmButtonExtender ID="DeleteButtonConfirmExtender" runat="server" 
																					 ConfirmText="Are you sure you want to delete this event?" 
																					 TargetControlID="DeleteButton" />
							</li>
						</ItemTemplate>
						<AlternatingItemTemplate>
							<li style="background-color: #BCDFF2; padding: 4px 4px; line-height: 16px;">
								<asp:ImageButton ID="EditButton" runat="server" CommandName="Edit" CommandArgument='<%# Eval("Id") %>' ImageUrl="~/Images/edit_Event_16.png" AlternateText="Open Event" ToolTip="Open Event" />
								<asp:ImageButton ID="DeleteButton" runat="server" CommandName="Delete" CommandArgument='<%# Eval("Id") %>' ImageUrl="~/Images/delete_16.png" AlternateText="Delete Event" ToolTip="Delete Event" />
								<asp:Literal ID="EventName" runat="server" Text='<%# Eval("Name") %>' />
								<cc1:ConfirmButtonExtender ID="DeleteButtonConfirmExtender" runat="server" 
																					 ConfirmText="Are you sure you want to delete this event?" 
																					 TargetControlID="DeleteButton" />
							</li>
						</AlternatingItemTemplate>
						<EmptyDataTemplate>
							<asp:Literal ID="EmptyList" runat="server" Text="You have not yet created any events" />
						</EmptyDataTemplate>
					</asp:ListView>
				</div>
			</td>
			<td valign="top">
				<asp:Panel ID="EditEventDetailsPanel" runat="server" Visible="false" CssClass="Event">
				  <div class="EventDetails">
					  <div class="SubHeader">
						  Event Details
						  <div style="float: right">
								<asp:ImageButton ID="EditEventDetailsButton" runat="server" ImageUrl="~/Images/edit_Event_16.png" AlternateText="Edit Details" ToolTip="Edit Details" OnClick="EditEventDetailsButton_Click" />
								<asp:ImageButton ID="EditEventPanelCloseButton" runat="server" ImageUrl="~/Images/close_16.png" AlternateText="Close" ToolTip="Close" OnClick="EditEventCloseButton_Click" />
						  </div>
				    </div>
				    <div style="margin: 8px;">
				      <asp:HiddenField ID="EditEventIdField" runat="server" />
				      <asp:Literal ID="EditEventNameLiteral" runat="server" />
				      <br /><br />
					    <asp:Literal ID="EditEventLocationLiteral" runat="server" />
					  </div>
					</div>
					<div class="Guests">
					  <div class="SubHeader">
					    Guests
					    <div style="float: right;">
							  <asp:ImageButton ID="GuestsAddButton" runat="server" ImageUrl="~/Images/add_16.png" AlternateText="Add Event Member" ToolTip="Add Event Member" />
						  </div>
					  </div>
					  <asp:ListView ID="EditEventGuestList" runat="server" 
													OnItemCommand="EditGuestList_ItemCommand" 
													OnItemDeleting="EditGuestList_ItemDeleting">
						  <LayoutTemplate>
							  <ul style="list-style-image: none; list-style-type: none; width: 354px; padding-left: 0px; margin: 0px;">
								  <asp:PlaceHolder ID="itemPlaceholder" runat="server" />
							  </ul>
						  </LayoutTemplate>
						  <ItemTemplate>
							  <li style="padding: 4px 4px; line-height: 16px;">
									<asp:ImageButton ID="DeleteButton" runat="server" CommandName="Delete" CommandArgument='<%# Eval("GuestId") + "," + ((int)Eval("GuestType")).ToString() %>' ImageUrl="~/Images/delete_16.png" AlternateText="Remove guest" ToolTip="Remove guest" />
							    <asp:Literal ID="GuestNameLiteral" runat="server" Text='<%# Eval("Name") %>' />
							    <cc1:ConfirmButtonExtender ID="DeleteButtonConfirmExtender" runat="server" 
																					 ConfirmText="Are you sure you want to delete this guest?" 
																					 TargetControlID="DeleteButton" />
							  </li>
						  </ItemTemplate>
						  <AlternatingItemTemplate>
							  <li style="background-color: #BCDFF2; padding: 4px 4px; line-height: 16px;">
									<asp:ImageButton ID="DeleteButton" runat="server" CommandName="Delete" CommandArgument='<%# Eval("GuestId") + "," + ((int)Eval("GuestType")).ToString() %>' ImageUrl="~/Images/delete_16.png" AlternateText="Remove guest" ToolTip="Remove guest" />
							    <asp:Literal ID="GuestNameLiteral" runat="server" Text='<%# Eval("Name") %>' />
							    <cc1:ConfirmButtonExtender ID="DeleteButtonConfirmExtender" runat="server" 
																						 ConfirmText="Are you sure you want to delete this guest?" 
																						 TargetControlID="DeleteButton" />
							  </li>
						  </AlternatingItemTemplate>
						  <EmptyDataTemplate>
  							
						  </EmptyDataTemplate>
					  </asp:ListView>
					</div>
				</asp:Panel>
			</td>
		</tr>
	</table>
	
	<!--Add Event Popup Panel-->
	<cc1:ModalPopupExtender ID="AddEventPanelPopupExtender" runat="server" 
													TargetControlID="EventListAddEventButton" 
													PopupControlID="ManageFamiliesAddEventPanel" 
													CancelControlID="AddEventCloseButton" 
													BackgroundCssClass="modalBackground" />
  <asp:Panel ID="ManageFamiliesAddEventPanel" runat="server" CssClass="PopupPanel" style="display: none;" > 
		<div class="PopupHeader">
			Add Event
			<div style="float: right">
				<asp:ImageButton ID="AddEventSaveButton" runat="server" ImageUrl="~/Images/save_16.png" AlternateText="Save Event" ToolTip="Save Event" OnClick="AddEventSaveButton_Click" ValidationGroup="AddEvent" style="margin-right: 4px;" />
			  <asp:ImageButton ID="AddEventCloseButton" runat="server" ImageUrl="~/Images/close_16.png" AlternateText="Close" ToolTip="Close" />
			</div>
		</div> 
    <table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2"><asp:ValidationSummary ID="AddEventValidationSummary" runat="server" ValidationGroup="AddEvent" /></td>
			</tr>
      <tr>
        <td><asp:Literal ID="AddEventNameLiteral" runat="server" Text="Name" /></td>
        <td>
          <asp:TextBox ID="AddEventNameTextBox" runat="server" MaxLength="50" />
          <asp:RequiredFieldValidator ID="AddEventNameRequiredValidator" runat="server" 
																			ErrorMessage="You must enter a Event name" 
																			ControlToValidate="AddEventNameTextBox"
																			Display="None" 
																			ValidationGroup="AddEvent" />
        </td>
      </tr>
      <tr>
        <td><asp:Literal ID="AddEventLocationLiteral" runat="server" Text="Location" /></td>
        <td>
          <asp:DropDownList ID="AddEventLocationDropDown" runat="server" />
          <asp:RequiredFieldValidator ID="AddEventLocationRequiredValidator" runat="server" 
																			ErrorMessage="You must select a location" 
																			ControlToValidate="AddEventLocationDropDown"
																			Display="None" 
																			ValidationGroup="AddEvent" />
        </td>
      </tr>
    </table>
  </asp:Panel>
  
  <!--Edit Event Popup Panel-->
	<cc1:ModalPopupExtender ID="EditEventPanelPopupExtender" runat="server" 
													TargetControlID="HiddenAction" 
												  PopupControlID="EditEventPanel" 
													CancelControlID="EditEventCloseButton" 
													BackgroundCssClass="modalBackground" />
	<asp:LinkButton ID="HiddenAction" runat="server" style="visibility: hidden;" />
  <asp:Panel ID="EditEventPanel" runat="server" CssClass="PopupPanel" style="display: none;" > 
		<div class="PopupHeader">
			Edit Event
			<div style="float: right">
				<asp:ImageButton ID="EditEventSaveButton" runat="server" ImageUrl="~/Images/save_16.png" AlternateText="Save Event" ToolTip="Save Event" OnClick="EditEventSaveButton_Click" ValidationGroup="EditEvent" style="margin-right: 4px;" />
			  <asp:ImageButton ID="EditEventCloseButton" runat="server" ImageUrl="~/Images/close_16.png" AlternateText="Close" ToolTip="Close" />
			</div>
		</div> 
    <table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td colspan="2"><asp:ValidationSummary ID="EditEventValidationSummary" runat="server" ValidationGroup="EditEvent" /></td>
			</tr>
      <tr>
        <td><asp:Literal ID="EditEventPopupNameLiteral" runat="server" Text="Name" /></td>
        <td>
          <asp:TextBox ID="EditEventNameTextBox" runat="server" MaxLength="50" />
          <asp:RequiredFieldValidator ID="EditEventNameRequiredValidator" runat="server" 
																			ErrorMessage="You must enter a Event name" 
																			ControlToValidate="EditEventNameTextBox"
																			Display="None" 
																			ValidationGroup="EditEvent" />
        </td>
      </tr>
      <tr>
        <td><asp:Literal ID="EditEventLocationNameLiteral" runat="server" Text="Location" /></td>
        <td>
          <asp:DropDownList ID="EditEventLocationDropDown" runat="server"/>
          <asp:RequiredFieldValidator ID="EditEventLocationRequiredValidator" runat="server" 
																			ErrorMessage="You must select a location" 
																			ControlToValidate="EditEventLocationDropDown"
																			Display="None" 
																			ValidationGroup="AddEvent" />
        </td>
      </tr>
    </table>
  </asp:Panel>
  
  <!--Add Event Member Popup-->
  <cc1:ModalPopupExtender ID="AddGuestsPanelPopupExtender" runat="server" 
													TargetControlID="GuestsAddButton" 
													PopupControlID="AddGuestPanel" 
													CancelControlID="AddGuestCloseButton" 
													BackgroundCssClass="modalBackground" />
  <asp:Panel ID="AddGuestPanel" runat="server" CssClass="PopupPanel" style="display: none;">
    <div class="PopupHeader">
			Add Guest
			<div style="float: right">
				<asp:ImageButton ID="AddGuestSaveButton" runat="server" ImageUrl="~/Images/save_16.png" AlternateText="Save Event" ToolTip="Save Event" OnClick="AddGuestSaveButton_Click" ValidationGroup="AddGuest" style="margin-right: 4px;" />
			  <asp:ImageButton ID="AddGuestCloseButton" runat="server" ImageUrl="~/Images/close_16.png" AlternateText="Close" ToolTip="Close" />
			</div>
		</div>
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td>
					<cc1:ListSearchExtender ID="ContactListBoxSearchExtender" runat="server" 
                            TargetControlID="ContactListBox" 
                            PromptPosition="Top" 
                            PromptText="Type to search" 
                            IsSorted="true" 
                            QueryPattern="StartsWith" />
					<asp:ListBox ID="ContactListBox" runat="server" SelectionMode="Multiple" style="width: 250px; height: 300px; margin-top: 16px; border: none 0px; border-top: solid 1px #000000;" />
				</td>
				<td>
					<cc1:ListSearchExtender ID="FamilyListBoxSearchExtender" runat="server" 
                            TargetControlID="FamilyListBox" 
                            PromptPosition="Top" 
                            PromptText="Type to search" 
                            IsSorted="true" 
                            QueryPattern="StartsWith" />
					<asp:ListBox ID="FamilyListBox" runat="server" SelectionMode="Multiple" style="width: 250px; height: 300px; margin-top: 16px; border: none 0px; border-top: solid 1px #000000;" />
				</td>
			</tr>
		</table>
  </asp:Panel>
</asp:Content>
